﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Configuration.Install;
using System.Reflection;
using Toolbox;

namespace Toolbox
{
    public static class Launcher
    {
        /// <summary>
        /// Point d'entrée principal de l'application.
        /// </summary>
       public  static void Main(params string[] args)
        {
            if (System.Environment.UserInteractive)
            {


                foreach (string a in args)
                {
                    switch (a)
                    {
                        case "--help":
                            return;

                        case "--install":
                            ManagedInstallerClass.InstallHelper(new string[] { Assembly.GetEntryAssembly().Location });
                            return;

                        case "--uninstall":
                            ManagedInstallerClass.InstallHelper(new string[] { "/u", Assembly.GetEntryAssembly().Location });
                            return;
                    }
                }

                Service svc = new Service();
                svc.Start(args);
            }
            else
            {
                Service svc = new Service();
                ServiceBase.Run(svc);
            }
        }
    }
}